Installing and starting the runtime system on Raspberry Pi

Requesting a license (incl. determining the serial number of the Raspberry Pi)

Without activated license, you can operate the runtime system as demo version only – as a full version for 3 hours after starting the runtime system. For a longer operation, it is recommended that you request and install a license.

  1. Again within the terminal window of PuTTY: Determine the serial number of your Raspberry Pi.

    cat /proc/cpuinfo

    Result: The serial number is displayed in the output, next to Serial. Preferably, select the serial number incl. all leading 0 in this output (this copies the serial number into the clipboard).
    Example for a serial number: 000000003ff12a33

  2. Create an e-mail to license@logicals.com.

  3. Enter the following data (as text) and send the mail.
    (Preferably, paste the copied serial number from the clipboard into the mail.)

    Name:
    Name of company:
    Address:
    Serial number of the Raspberry Pis:
    Target platform: Raspbian/ARM11
    Features: (Add a "x" for each requested feature.)
      [x] RTS
      [ ] MODBUS 

    See FAQ-article "Which features are provided for the runtime system", if you need information on the features.

You will obtain a license file logirts.lic from Neuron. This license file is only valid for your Raspberry Pi.

Installing the runtime system on Raspberry Pi

Version for the runtime system to be installed

Install the version of Neuron RTS max that is included in the downloaded package. See "Release notes for current version" for information which version of Neuron RTS max is valid for the current version of Neuron Power Engineer.
But mind the following: If you are using versions < 2.3.602 of Neuron RTS max, there might be unexpected terminations of the licensed Neuron RTS max version on the Raspberry Pi.

  1. Again within the terminal window of PuTTY: Create the directory /opt/RTS on the Raspberry Pi and change into this directory.

    mkdir –p /opt/RTS
    cd /opt/RTS
  2. Transfer the file logiRTS_Vx.y.z_Raspbian.tar.gz onto the Raspberry Pi. The tar.gz-file is included in the delivery range of Neuron Power Engineerx.y.z is a placeholder for the respective version number.

    1. Open a command prompt of your operating system.

    2. Go to the directory where PSCP (the file pscp.exe) is located.

    3. Copy the logiRTS_Vx.y.z_Raspbian.tar.gz into this directory. 

    4. In this command prompt, enter the following command:

      pscp logiRTS_Vx.y.z_Raspbian.tar.gz <USER>@IP_ADDRESS:/home/USER/logiRTS_Vx.y.z_Raspbian.tar.gz

      Example in case of IP-address 192.168.1.225 of a Raspberry Pi and Neuron RTS max version 2.3.602, the user is TTe:

       pscp logiRTS_V2.3.602_Raspbian.tar.gz TTe@192.168.1.22:/home/TTe/logiRTS_V2.3.602_Raspbian.tar.gz
    5. Enter the password for the user.

    6. In this command prompt, enter the following command (replace the relevant data accordingly):

      mv /home/USER/logiRTS_Vx.y.z_Raspbian.tar.gz /opt/RTS/
  3. Again within the terminal window of PuTTY: Check whether the file has been transferred.

    ls -lah

    The file logiRTS_Vx.y.z_Raspbian.tar.gz must be listed.

  4. Unpack the file. Replace x.y.z by the respective version number.

    tar --no-same-owner -xzf logiRTS_Vx.y.z_Raspbian.tar.gz 
  5. Check whether the file has been unpacked.

    ls -lah

    The sub-folders of Neuron RTS max must be listed (e.g. sub-folder bin).

  6. Delete the file logiRTS_Vx.y.z_Raspbian.tar.gz on the Raspberry Pi. Again, replace x.y.z by the respective version number.

    rm logiRTS_Vx.y.z_Raspbian.tar.gz

Installing the license

Install the license for Neuron RTS max only if Neuron RTS max has already been installed on the Raspberry Pi.

  1. Copy the license file logirts.lic into the directory where PSCP (the file pscp.exe) is located.

  2. In the command prompt still open, enter the following command:

    pscp logirts.lic <USER>@IP_ADDRESS:/home/<USER>/logirts.lic

    Example in case of IP-address 192.168.1.225 of a Raspberry Pi, the user is TTe:

    pscp logirts.lic TTe@192.168.1.225:/home/TTe/logirts.lic
  3. Enter the password for the user.

  4. In this command prompt, enter the following command (replace the relevant data accordingly):

    mv /home/USER/logirts.lic /opt/RTS/

Of course, it is possible to install the license later on: Just transfer the license file logirts.lic into the directory opt/RTS on the Raspberry Pi. Until you have done so, Neuron RTS max is operated as a demo version.

Configuring Neuron RTS max: traces in "PLC Logging" view and in syslog

Only necessary if you want to have Neuron RTS max traces displayed in the PLC Logging view of Neuron Power Engineer without a connection to the Raspberry Pi: 

  1. Define the environment variable RTS_LOG_UDP.
    You are able to define environment variables by using the command export e.g. in a terminal window of PuTTY. If in doubt, ask an administrator for support.
    Example for defining the environment variable:

    export RTS_LOG_UDP=192.168.1.239:7777
  2. As value, first define the IP-address of the computer where Neuron Power Engineer is used, then add : and conclude with the port 7777. Hence, the value for a computer with IP-address 192.168.1.239 is: 192.168.1.239:7777
    If you do not know the IP-address, ask your administrator for this piece of information.  

Only necessary if you do not start Neuron RTS max via systemd but you want to have Neuron RTS max traces displayed in the →syslog of the Raspberry Pi nevertheless: 

Define the environment variable RTS_LOG_SYSLOG.
You are able to define environment variables by using the command export e.g. in a terminal window of PuTTY. If in doubt, ask an administrator for support.
Example for defining the environment variable:

export RTS_LOG_SYSLOG=1

(info) Effects:

  • The following output is filed according to the system logging configuration of the target system:

    • log messages of the runtime system

    • log messages of the Trace block within the PLC-programs

    • all log messages of →vendor blocks when using the RT_TRACE() macro or the rt_trace() functions

  • By default, traces of the runtime system are filed in a file within the directory /var/log of the target system. Usually this file is:

    • /var/log/messages in case of systems that are using SysV-Init and the "syslog" service (usually, these are older systems)

    • /var/log/syslog in case of systems that are using the "SystemD" service (current Linux distributions, such as  Ubuntu 18)

  • In order to change the filing location, adjust the configuration in the system files (/etc/syslog.conf/etc/syslog.d/,  /etc/rsyslog.conf//etc/rsyslog.d/). See the following websites for more information:

  • (warning) Logging of the traces of the runtime system to syslog influences the behavior of the runtime system.

  • (warning) In case of SystemD based systems without installed Syslog service, it might be necessary to use journactl in order to display the output. The reason for this is because the above-mentioned files do not exist.

Notes:

  • If the runtime system is started as SystemD service, it is not necessary to activate the logging via the syslog mechanism. The output is automatically saved in the SystemD journals. It is possible to display them by using the system-specific logging viewer (e.g. by journalctl --unit=logirts).

Starting the runtime system on Raspberry Pi

  1. Again within the terminal window of PuTTY: Change into the directory opt/RTS/bin of the Raspberry Pi.

    cd /opt/RTS/bin/
  2. Start Neuron RTS max on the Raspberry Pi. Press the Enter-key until the input mask of the terminal window is visible again.

    ./startPLC &

Starting Neuron RTS max at system start

Add Neuron RTS max to the system start by systemd or using an init script file. Subsequently, Neuron RTS max will run after each reboot of the Raspberry Pi.

System start by using systemd

Start using "systemd"

If you want to use systemd for starting Neuron RTS max and you need details on the procedure, contact the support team of Neuron for more information..
See https://freedesktop.org/wiki/Software/systemd/ for information on systemd.

Creating a service file

  1. Create an empty service file for Neuron RTS max.

    nano /lib/systemd/system/logirts.service
  2. Copy the following lines into this file (observe that there are no empty lines inserted by mistake at the beginning of the file):

    [Unit]
    Description=RTS
    # uncomment the following line if your system needs a codemeter stick for the licence
    #Requires=codemeter.service
    After=multi-user.target
     
    [Service]
    Type=simple
    WorkingDirectory=/opt/RTS
     
    Environment="LD_LIBRARY_PATH=/opt/RTS/lib"
    # enter the ip address of your development system in the next line, if you want to see RTS traces in the development environment
    Environment=RTS_LOG_UDP=127.0.0.1:7777
    ExecStart=/opt/RTS/bin/RTSLoader -b /opt/RTS/PLC
    Restart=on-failure
    RestartSec=1
     
    [Install]
    WantedBy=multi-user.target
  3. Save the changes and exit the editor: Press Ctrl+O (and confirm the file name), then press Ctrl+X.

Activating the new service

systemctl daemon-reload
systemctl enable logirts.service

System start by using init script file

Creating an init script file

  1. Create an empty init script file for Neuron RTS max.

    nano /etc/init.d/startPLC
  2. Copy the following lines into this file (observe that there are no empty lines inserted by mistake at the beginning of the file):

    #!/bin/sh
    ### BEGIN INIT INFO
    # Provides: RTSLoader
    # Required-Start:
    # Required-Stop:
    # Default-Start: 5
    # Default-Stop: 0 1 2 3 4 6
    # Short-Description: Starts the runtime system
    # Description:
    ### END INIT INFO
     
    case "$1" in
    start)
    cd /opt/RTS/bin
    ./startPLC &
    echo "Starting the runtime system"
    ;;
    stop)
    sudo pkill RTSLoader
    echo "Runtime system stopped"
    ;;
    *)
    echo "Usage: /etc/init.d/startPLC {start|stop}"
    exit 1
    ;;
    esac
    exit 0
  3. Save the changes and exit the editor: Press Ctrl+O (and confirm the file name), then press Ctrl+X.

  4. Change the permissions for the file.

    chmod +x /etc/init.d/startPLC
  5. Convert the file to Unix (so that possibly problematic Windows characters are removed).

    dos2unix /etc/init.d/startPLC

Adding init script file to the system start

update-rc.d startPLC defaults

Restarting Raspberry Pi and logging on as user "root"

  1. Restart the Raspberry Pi in order to accept all changes made until now.

    shutdown now -r
  2. Confirm the displayed messages.

  3. Wait for about 1 minute. Then in PuTTY, re-connect to the Raspberry Pi: Open the system menu of PuTTY (by clicking the system icon in the title bar) and select command Restart Session.

  4. Log on as user root with the password.

    login as: root
    root@192.168.1.225's password: _password for root_

    The text for the password is not displayed in the terminal window

  5. Check whether Neuron RTS max has really started.

    ps aux | grep RTS

    The listed processes must include RTSLoader.

Closing PuTTY and command promt

As there are no more steps to be done directly on the Raspberry Pi while following this tutorial, close PuTTY and the command prompt (double-click on the system icon in the title bar).